package com.xiaoshuidi.cloud.module.contract.controller.admin.bill;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.CompanyCustomerBillDetailResp;
import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.CompanyCustomerBillPageReq;
import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.CompanyCustomerBillPageResp;
import com.xiaoshuidi.cloud.module.contract.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.contract.service.bill.CompanyCustomerBillService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 企业客户 - 房屋账单
 *
 * @Author Feng
 * @date 2023/7/3
 */
@RestController
@RequestMapping(ApiConstants.NAME + "/company-customer-bill")
@RequiredArgsConstructor
public class CompanyCustomerBillController {

    private final CompanyCustomerBillService companyCustomerBillService;

    /**
     * 房屋账单 - 分页列表
     *
     * @param req
     * @return
     */
    @GetMapping("/page")
    public CommonResult<PageResult<CompanyCustomerBillPageResp>> page(@Valid CompanyCustomerBillPageReq req) {
        return CommonResult.success(companyCustomerBillService.page(req));
    }

    /**
     * 房屋账单 - 详情列表
     *
     * @param businessId
     * @return
     */
    @GetMapping("/detail")
    public CommonResult<List<CompanyCustomerBillDetailResp>> billDetail(@RequestParam("businessId") Long businessId) {
        return CommonResult.success(companyCustomerBillService.billDetail(businessId));
    }
}